package com.oms.listener;

import com.pace.cloud.common.entities.kafka.util.MessageUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class OmsMsgListener {

//    @Value("${spring.application.name}")
//    public void setGroupId(String applicationName) {
//        String groupCode = applicationName;
//        System.setProperty("omsd.group.id", groupCode);
//    }

    @KafkaListener(topics = {MessageUtils.TOPIC_MESSAGE})
    public void listen(ConsumerRecord<String, String> record) {
        log.info("OmsMsgListener key: {}, value: {}", record.key(), record.value());
    }
}
